package com.Final.hj;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

public class SeachFriendAdapter extends ArrayAdapter<SeachFriedList> {
    private int seach_friend_id;
    public SeachFriendAdapter(Context context, int musicId, List<SeachFriedList> musicData){
        super(context, musicId, musicData);
        seach_friend_id = musicId;
    }

    @Override
    public View getView(int position, View converView, ViewGroup parent){
        //获取当前滚动实例
        SeachFriedList seachFList = getItem(position);

        View view = LayoutInflater.from(getContext()).inflate(seach_friend_id, parent, false);

        ImageView seach_f_img = (ImageView) view.findViewById(R.id.seach_f_img);
        TextView seach_f_uname = (TextView) view.findViewById(R.id.seach_f_uname);
        TextView seach_f_gender = (TextView) view.findViewById(R.id.seach_f_gender);
        TextView seach_f_type = (TextView) view.findViewById(R.id.seach_f_type);
        //设置相应的内容
        seach_f_uname.setText(seachFList.getUname());
        seach_f_gender.setText(seachFList.getGender());
        seach_f_type.setText(seachFList.getType());

        seach_f_img.setImageResource(Integer.parseInt(seachFList.getHImgId()));
//        seach_f_img.setImageResource(R.drawable.nine);
//        Glide.with(getContext())
//                .load(seachFList.getImgId())
//                .skipMemoryCache(true)
//                .diskCacheStrategy(DiskCacheStrategy.NONE)
//                .into(seach_f_img);
        //返回view
        return view;
    }
}
